class Solution:
    def checkArithmeticSubarrays(self, nums: list, l: list, r: list) -> list:
        def isArithmeticSubarrays(nums):
            if len(nums) <= 2:
                return True
            nums.sort()
            diff = nums[1] - nums[0]
            for i in range(1, len(nums)-1):
                if nums[i+1] - nums[i] != diff:
                    return False

            return True

        res = []
        for i in range(len(l)):
            res.append(isArithmeticSubarrays(nums[l[i]:r[i]+1]))

        return res
